package com.lujianfei.waterpower.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.lujianfei.waterpower.R;


public class EmptyView extends RelativeLayout {

    private TextView txt_title;
    Button bt_click;
    public EmptyView(Context context) {
        super(context);
        initView(context);
    }

    public EmptyView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    public EmptyView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }

    private void initView(Context context) {
        LayoutInflater.from(context).inflate(R.layout.widget_empty_view,this,true);
        txt_title = findViewById(R.id.txt_title);
        bt_click = findViewById(R.id.bt_click);
    }

    public void setTitleText(String title){
        txt_title.setText(title);
    }
    public void setButtonText(String text){
        bt_click.setText(text);
    }

    public void setOnClickListener(OnClickListener onClickListener){
        bt_click.setOnClickListener(onClickListener);
    }

    public void hideButton(){
        bt_click.setVisibility(View.GONE);
    }

    public void showButton(){
        bt_click.setVisibility(View.VISIBLE);
    }
}
